﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
using KPIS.GERP.Models.Class;

namespace KPIS.GERP.Models.ICM
{
    [DataContract, Table("IcmWarehousePermit")]
    public class WarehousePermit
    {
        public WarehousePermit()
        {
            RecordStatus = "U";

            //Requests = new HashSet<RequestParcel>();
        }

        [Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
        [DataMember, Display(Name = "WarehousePermitId", ResourceType = typeof(Resources.WarehousePermitResource))]
        public int WarehousePermitId { get; set; }

        [CustomRequired]
        [ForeignKey("Warehouse")]
        [DataMember, Display(Name = "WhId", ResourceType = typeof(Resources.WarehousePermitResource))]
        public int WhId { get; set; }

        [CustomRequired]
        [ForeignKey("JobSite")]
        [DataMember, Display(Name = "JobSiteId", ResourceType = typeof(Resources.WarehousePermitResource))]
        public Nullable<int> JobSiteId { get; set; }

        [StringLength(2)]
        [DataMember, Display(Name = "RecordStatus", ResourceType = typeof(Resources.WarehousePermitResource))]
        public string RecordStatus { get; set; }

        [DataMember, Display(Name = "CreatedBy", ResourceType = typeof(Resources.WarehousePermitResource))]
        public int? CreatedBy { get; set; }

        [DataMember, Display(Name = "CreatedWhen", ResourceType = typeof(Resources.WarehousePermitResource))]
        public DateTime? CreatedWhen { get; set; }

        [DataMember, Display(Name = "UpdatedBy", ResourceType = typeof(Resources.WarehousePermitResource))]
        public Nullable<int> UpdatedBy { get; set; }

        [DataMember, Display(Name = "UpdatedWhen", ResourceType = typeof(Resources.WarehousePermitResource))]
        public Nullable<DateTime> UpdatedWhen { get; set; }

        [DataMember]
        public virtual Warehouse Warehouse { get; set; }

        [DataMember]
        public virtual HRM.JobSite JobSite { get; set; }

        //[DataMember]
        //public virtual ICollection<RequestParcel> Requests { get; set; }
    }
}
